#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
using LL = long long;
const int N = 1000010;
int n;
int primes[N], phi[N];
bool st[N];
LL get_euler()
{
    int cnt = 0;
    phi[1] = 1;
    for (int i = 2; i <= n; i++)
    {
        if (!st[i])
        {
            primes[cnt++] = i;
            phi[i] = i - 1;
        }
        for (int j = 0; primes[j] <= n / i; j++)
        {
            st[primes[j] * i] = true;
            if (i % primes[j] == 0)
            {
                phi[primes[j] * i] = phi[i] * primes[j];
                break;
            }
            phi[primes[j] * i] = phi[i] * (primes[j] - 1);
        }
    }
    LL res = 0;
    for (int i = 1; i <= n; i++) res += phi[i];
    return res;
}
int main()
{
    cin >> n;
    cout << get_euler();
    return 0;
}
